package org.ilc;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @author malongbo
 * @time 13-7-13 上午9:17
 */
public class SendClient {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 8889);

        OutputStream out = socket.getOutputStream();

        StringBuffer buffer = new StringBuffer();

        buffer.append("auth-user:201301001\n");
        buffer.append("auth-password:301001\n");
        buffer.append("auth-type:1\n");
        buffer.append("receiver:201202002\n");

        String msg = "hello world";
        buffer.append("content-length:" + msg.getBytes().length);

        out.write(buffer.toString().getBytes());

        out.write(msg.getBytes());

        out.flush();

        out.close();


    }
}
